<template>
  <div class="detail-box" @click="handleToDetail(id)">
    <van-image :src="image" class="detail-img" fit="cover">
      <template v-slot:loading>
        <van-loading type="spinner" size="20" />
      </template>
    </van-image>
    <div class="detail-info">
      <div class="detail-top">
        <div class="detail-title">
          <div class="name van-ellipsis">{{name}}</div>
          <div class="writer van-ellipsis">{{writer}}</div>
        </div>
        <div class="detail-tag">
          <van-tag color="#DCC3FF" plain>{{is_over}}</van-tag>
          <van-tag color="#FFCCCC" plain>{{type}}</van-tag>
        </div>
      </div>
      <div class="detail-intro van-multi-ellipsis--l2">{{intro}}</div>
    </div>
  </div>
</template>

<script>
import Taro from "@tarojs/taro";
export default {
  name: "DetailCard",
  data() {
    return {};
  },
  props: {
    name: String,
    writer: String,
    is_over: String,
    type: String,
    intro: String,
    id: [Number,String],
    image:{
      default:'http://foglake.sanye666.top/images/default-covor.jpg',
      type:String
    }
  },
  methods: {
    handleToDetail(id) {
      Taro.navigateTo({
        url: `/pages/bookdetail/bookdetail?id=${id}`,
      });
    },
  },
};
</script>

<style scoped>
.detail-box {
  display: flex;
  margin-bottom: 32px;
}

.detail-img {
  height: 200px;
  width: 150px;
  border-radius: 12px;
  background-repeat: no-repeat;
  background-size: 200px 150px;
  margin-right: 36px;
}

.detail-info {
  width: 72%;
}

.detail-top {
  display: flex;
  justify-content: space-between;
}

.detail-title {
}

.name {
  font-size: 28px;
  font-family: Alibaba PuHuiTi;
  /* font-weight: bold; */
  color: rgba(6, 27, 65, 0.75);
  margin-bottom: 12px;
}

.writer {
  font-size: 20px;
  font-family: Alibaba PuHuiTi;
  font-weight: 400;
  color: rgba(6, 27, 65, 0.35);
  margin-bottom: 30px;
}

.detail-tag {
  font-size: 18px;
  font-family: Alibaba PuHuiTi;
  font-weight: 400;
}

.detail-intro {
  font-size: 22px;
  font-family: Alibaba PuHuiTi;
  font-weight: 400;
  color: rgba(6, 27, 65, 0.35);
}
</style>